package com.cpkso.buss.backend.user.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;

import com.cpkso.buss.backend.user.vo.LoginVo;

/**
 * @author wrzhxy@qq.com
 * @date 2018年3月26日
 */
@SuppressWarnings("rawtypes")
public class LoginValidator {
	public boolean supports(Class aClass) {
        return LoginVo.class.isAssignableFrom(aClass);
    }

    public void validate(Object o, Errors errors) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "error.username.empty", "Please specify a username.");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "error.password.empty", "Please specify a password.");
    }
}
